package com.kang.service.warMap.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kang.bean.bot.MapType;
import com.kang.mapper.MapTypeMapper;
import com.kang.service.warMap.MapTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @program: service
 * @description:
 * @author: K.faWu
 * @create: 2022-05-09 13:59
 **/
@Service
public class MapTypeServiceImpl extends ServiceImpl<MapTypeMapper, MapType> implements MapTypeService {
    @Autowired
    private MapTypeMapper mapTypeMapper;


    @Override
    public List<MapType> getAll() {
        return mapTypeMapper.selectList(new QueryWrapper<>());
    }

    @Override
    public Map<String, MapType> getMapAll(){
        List<MapType> typeList = mapTypeMapper.selectList(new QueryWrapper<>());
        Map<String, MapType> typeMap = new HashMap<>(4);
        for (MapType mapType : typeList){
            String typeCode = mapType.getTypeCode();
            typeMap.put(typeCode, mapType);
        }
        return typeMap;
    }
}
